<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-label-edit" th:object="${label}">
			<input name="userId"  type="hidden"  th:field="${label.userId}" />
			<input name="pictureId"  type="hidden"  th:field="${label.pictureId}" />
			<div class="form-group">
				<label class="col-sm-3 control-label ">图片标签：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="pictureLabel"  th:field="*{pictureLabel}"/>
				</div>
			</div>

			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
	</div>
	<div th:include="include::footer"></div>
	<script th:src="@{/ajax/libs/select/select2.js}"></script>
	<script>
	   
	$("#form-label-edit").validate({
    	rules:{
    		userName:{
    			required:true,
    		}
    	},
    	submitHandler:function(form){
    		edit();
    	}
	});
		
    function edit() {
    	var userId = $("input[name='userId']").val();
    	var pictureId = $("input[name='pictureId']").val();
    	var pictureLabel = $("input[name='pictureLabel']").val();
    	$.ajax({
    		cache : true,
    		type : "POST",
    		url : ctx + "system/label/edit",
    		data : {
    			"userId": userId,
    			"pictureId": pictureId,
    			"pictureLabel": pictureLabel,
    		},
    		async : false,
    		error : function(request) {
    			$.modal.alertError("系统错误");
    		},
    		success : function(data) {
    			$.operate.saveSuccess(data);
    		}
    	});
    }
    </script>
</body>
</html>
